package validationTestSuite.tests
{
	import com.google.code.flexmetavalidator.metavalidation.MetaValidator;
	
	import org.flexunit.Assert;
	import org.flexunit.asserts.assertFalse;
	import org.flexunit.asserts.assertTrue;
	
	import validationTestSuite.tests.vo.LengthObject;
	import validationTestSuite.tests.vo.NotNullObject;
	
	public class LengthTest extends MetaValidatorTest
	{
		public function LengthTest()
		{
			super();
		}
		
		[Test]
		public function testNoMinNoMax():void
		{
			var object : LengthObject = new LengthObject();
			var testResult : Boolean = validator.validate(object);
			assertTrue(testResult);
			
			object = new LengthObject();
			object.varStringNoMinNoNax = "ABCDEFGH";
			testResult = validator.validate(object);
			assertTrue(testResult);
			
			object = new LengthObject();
			object.varStringNoMinNoNax = "";
			testResult = validator.validate(object);
			assertTrue(testResult);		
			
			for each (var errStr : String in validator.errors) {trace(errStr)}
		}
		
		[Test]
		public function testMin():void
		{
			var object : LengthObject = new LengthObject();
			var testResult : Boolean = validator.validate(object);
			assertTrue(testResult);
			
			object = new LengthObject();
			object.varStringMin = "ABC";
			testResult = validator.validate(object);
			assertTrue(testResult);
			
			object = new LengthObject();
			object.varStringMin = "";
			testResult = validator.validate(object);
			assertFalse(testResult);		
			
			for each (var errStr : String in validator.errors) {trace(errStr)}
		}
		
		[Test]
		public function testMax():void
		{
			var object : LengthObject = new LengthObject();
			var testResult : Boolean = validator.validate(object);
			assertTrue(testResult);
			
			object = new LengthObject();
			object.varStringMax = "";
			testResult = validator.validate(object);
			assertTrue(testResult);
			
			object = new LengthObject();
			object.varStringMax = "ABC";
			testResult = validator.validate(object);
			assertTrue(testResult);
			
			object = new LengthObject();
			object.varStringMax = "ABCDEFGH";
			testResult = validator.validate(object);
			assertFalse(testResult);		
			
			for each (var errStr : String in validator.errors) {trace(errStr)}
		}
		
		[Test]
		public function testMinMax():void
		{
			var object : LengthObject = new LengthObject();
			var testResult : Boolean = validator.validate(object);
			assertTrue(testResult);
			
			object = new LengthObject();
			object.varStringMinMax = "";
			testResult = validator.validate(object);
			assertFalse(testResult);
			
			object = new LengthObject();
			object.varStringMinMax = "ABCD";
			testResult = validator.validate(object);
			assertFalse(testResult);
			
			object = new LengthObject();
			object.varStringMinMax = "A";
			testResult = validator.validate(object);
			assertTrue(testResult);
			
			for each (var errStr : String in validator.errors) {trace(errStr)}
		}
		
		
		
	}
}